package com.wl156.model;

import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Vector;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.MarshalDate;
import org.ksoap2.serialization.MarshalFloat;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log;

public class WebServiceClient {

	private static final String TAG = null;
	public static SimpleDateFormat sDateFormat = new SimpleDateFormat(
			"yyyy-MM-dd");

	private Context mContext;

	public WebServiceClient(Context context) {
		mContext = context;
	}

	protected Object callWebService(String url, String nameSpace,
			String methodName, HashMap<String, Object> params,
			List<PropertyInfo> properties, HashMap<String, String> headers)
			throws IOException, XmlPullParserException {
		String SOAP_ACTION = nameSpace + methodName;
		SoapObject request = new SoapObject(nameSpace, methodName);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
				SoapEnvelope.VER11);
		envelope.dotNet = true;
		envelope.setOutputSoapObject(request);

		if (params != null && !params.isEmpty()) {
			for (Iterator it = params.entrySet().iterator(); it.hasNext();) {
				Map.Entry e = (Entry) it.next();
				request.addProperty(e.getKey().toString(), e.getValue());
			}
		}

		if (properties != null && !properties.isEmpty()) {
			for (PropertyInfo propertyInfo : properties) {
				request.addProperty(propertyInfo);
			}
		}

		envelope.addMapping(NAMESPACE, "Certificate",
				new Certificate().getClass());
		MarshalDate marshalDate = new MarshalDate();
		marshalDate.register(envelope);
		MarshalFloat marshalFloat = new MarshalFloat();
		marshalFloat.register(envelope);
		// envelope.addMapping(NAMESPACE, "dateTime", MarshalDate.DATE_CLASS);
		// envelope.addMapping(NAMESPACE, "decimal", MarshalFloat.class);

		// ArrayList<HeaderProperty> headerProperty = new
		// ArrayList<HeaderProperty>();
		// if (headers != null && !headers.isEmpty()) {
		// for (Map.Entry<String, String> entry : headers.entrySet()) {
		// headerProperty.add(new HeaderProperty(entry.getKey(), entry
		// .getValue()));
		// }
		// }

		int timeout = 6000;
		HttpTransportSE androidHttpTrandsport = new HttpTransportSE(url,
				timeout);
		androidHttpTrandsport.debug = true;
		Object result = null;
		androidHttpTrandsport.call(SOAP_ACTION, envelope);
		Log.d(TAG, "requestDump: " + androidHttpTrandsport.requestDump);
		Log.d(TAG, "responseDump: " + androidHttpTrandsport.responseDump);
		result = envelope.getResponse();
		if (result != null) {
			Log.d(TAG, "result: " + result + ", type: "
					+ result.getClass().getSimpleName());
		} else {
			Log.d(TAG, "result: " + result);
		}
		return result;
	}

	// public static final String BASE_URL = "http://fenky.ym6.cn:8080/";
	public static final String BASE_URL = "http://202.104.188.11:8080/";
	// public static final String BASE_URL = "http://183.46.245.132:8080/";
	// public static final String BASE_URL = "http://121.11.28.232:8080/";

	private static final String NAMESPACE = "http://202.104.188.11:8080/";

	private static final String METHOD_COMMON_GET_MY_CURRENT_PLACE = "common_getMyCurrentPlace";
	private static final String METHOD_COMMON_GET_PERSONAL_INFO = "common_getPersonalInfo";
	private static final String METHOD_COMMON_FIND_TRUNK_MESSAGE = "common_findTruckMessage";
	private static final String METHOD_COMMON_FIND_TRUCK_MESSAGE_DETAIL = "common_findTruckMessageDetail";
	private static final String METHOD_COMMON_FIND_FREIGHT_MESSAGE = "common_findFreightMessage";
	private static final String METHOD_COMMON_FIND_FREIGHT_MESSAGE_DETAIL = "common_findFreightMessageDetail";
	private static final String METHOD_COMMON_PUBLISH_SPECIAL_LINE = "common_publishSpecialLine";
	private static final String METHOD_COMMON_FIND_SPECIAL_LINES = "common_findSpecialLines";
	private static final String METHOD_COMMON_FIND_SPECIAL_LINE_DETAIL = "common_findSpecialLineDetail";
	private static final String METHOD_COMMON_GET_TRUCK_LIST = "common_getTruckList";
	private static final String METHOD_COMMON_FIND_TRUCK = "common_findTruck";
	private static final String METHOD_COMMON_FIND_TRUCK_DETAIL = "common_findTruckDetail";
	private static final String METHOD_COMMON_FIND_COMPANY = "common_findLogisticCompanys";
	private static final String METHOD_COMMON_FIND_COMPANY_DETAIL = "common_findLogisticCompanyDetail";
	private static final String METHOD_COMMON_FIND_MAP_LOCATION = "common_findMapLocation";
	private static final String METHOD_COMMON_GET_MY_STORE_GROUPS = "common_getMyStoreGroups";
	private static final String METHOD_COMMON_MODIFY_STORE_GROUP_ADD = "common_modifyStoreGroupAdd";
	private static final String METHOD_COMMON_MODIFY_STORE_GROUP_DELETE = "common_modifyStoreGroupDelete";
	private static final String METHOD_COMMON_MODIFY_STORE_GROUP_MOVE_ITEM_TO_ANOTHER_GROUP = "common_modifyStoreGroupMoveItemToAnotherGroup";
	private static final String METHOD_COMMON_MODIFY_STORE_GROUP_REMOVE_ITEM = "common_modifyStoreGroupRemoveItem";
	private static final String METHOD_COMMON_MODIFY_STORE_GROUP_UPDATE = "common_modifyStoreGroupUpdate";
	private static final String METHOD_COMMON_STORE_GROUP_ADD_SPECIAL_LINE_TO_GROUP = "common_modifyStoreGroupAddSpecialLineToGroup";
	private static final String METHOD_COMMON_STORE_GROUP_GET_MY_STORED_SPECIAL_LINES = "common_storeGroupGetMyStoredSpecialLines";

	private static final String METHOD_COMPANY_MODIFY_STORE_GROUP_ADD_TRUCK_TO_GROUP = "company_modifyStoreGroupAddTruckToGroup";
	private static final String METHOD_COMPANY_STORE_GROUP_GET_MY_STORED_TRUCKS = "company_storeGroupGetMyStoredTrucks";
	private static final String METHOD_DRIVER_MODIFY_STORE_GROUP_ADD_FREIGHT_MESSAGE_TO_GROUP = "driver_modifyStoreGroupAddFreightMessageToGroup";
	private static final String METHOD_DRIVER_STORE_GROUP_GET_MY_STORED_FREIGHT_MESSAGE = "driver_storeGroupGetMyStoredFreightMessage";

	private static final String METHOD_SYS_LOGIN = "sys_login_new";
	private static final String METHOD_SYS_REQUIRE_NEW_INTERNAL_MESSAGE = "sys_requireNewInternalMessage";
	private static final String METHOD_COMMON_GETMY_INTERNAL_MESSAGE = "common_getMyInternalMessage";
	private static final String METHOD_SYS_ACTIVE = "sys_active";
	private static final String METHOD_SYS_LOGOUT = "sys_logout";
	private static final String METHOD_SYS_REGISTER = "sys_register";

	private static final String METHOD_COMPANY_PUBLISH_FREIGHT_MESSAGE = "company_publicFreightMessage";
	private static final String METHOD_COMPANY_FIND_MY_FREIGHT_MESSAGE = "company_findMyFreightMessage";
	private static final String METHOD_COMPANY_CREATE_ORDER = "company_createOrder";
	private static final String METHOD_COMPANY_UNLOCK_ORDER_TO_TRUCK_DRIVER = "company_unlockOrderToTruckDriver";
	private static final String METHOD_COMPANY_GET_MY_ORDERS = "company_getMyOrders";
	private static final String METHOD_COMPANY_GET_MY_ORDER_VIEW = "company_getMyOrderView";
	private static final String COMPANY_STATUS = "company_Status";

	private static final String DRIVER_GETMYORDERS = "driver_getMyOrders";
	private static final String DRIVER_GETMYORDERVIEW = "driver_getMyOrderView";
	private static final String DRIVER_STATUS = "driver_Status";

	private static final String METHOD_DRIVER_PUBLISH_TRUCK_MESSAGE = "driver_publishTruckMessage";
	private static final String METHOD_COMMON_GET_MY_TRUCK = "driver_getMyTruck";

	private static final String COMMON_GET_MY_SUBSCRIBE = "common_getMySubscribe";
	private static final String COMMON_MODIFY_SUBSCRIBE = "common_modifySubscribe";
	private static final String COMMON_ADD_SUBSCRIBE = "common_addSubscribe";
	private static final String COMMON_DELETE_SUBSCRIBE = "common_deleteSubscribe";

	private static final String DRIVER_CARINFOSATATUS = "driver_CarInfoStatus";
	private static final String COMPANY_CARGOSINFOSTATUS = "company_CargosInfoStatus";

	private static final String DRIVER_GETMYCARINFO = "driver_getMyCarInfo";
	private static final String COMPANY_FINDMYMESSAGE = "company_findMyMessage";

	private static final String COMPANY_FINDSPECIALLINES = "company_findSpecialLines";
	private static final String COMMON_FINDUSERINFO = "common_findUserInfo";
	private static final String COMMON_FINDUSERORDERINFO = "common_findUserOrderInfo";

	private static final String COMMON_AUTOUPDATE = "common_AutoUpdate";

	private static final String COMPANY_GETMYTRUCK = "company_getMyTruck";
	private static final String COMPANY_GETMYTRUCKBYID = "company_getMyTruckByID";

	private static final String COMMON_ADDCARINFO = "common_AddCarInfo";

	private static final String COMMON_GETBALANCE = "common_getBalance";

	private static final String COMMON_GETNEWS = "common_getNews";
	private static final String COMMON_GETNEWSVIEW = "common_getNewsView";
	private static final String COMMON_GETMYPAYLOG = "common_getMyPayLog";
	private static final String COMMON_TRANSFERTOSYSTEMACCOUNT = "common_transferToSystemAccount";
	private static final String COMMON_TRANSFERTOUSERACCOUNT = "common_transferToUserAccount";

	private static final String COMMON_SETMYINFO = "common_SetMyInfo";
	private static final String COMMON_MODIFYPASSWORD = "common_ModifyPassword";
	private static final String COMMON_GETMYINFO = "common_GetMyInfo";

	private static final String COMMON_GETMYVERIFICATIONCODE = "common_GetMyVerificationCode";
	private static final String COMMON_MODIFYPWD = "common_ModifyPWD";

	private static final String MYLONGITUDEANDLATITUDE = "MyLongitudeAndLatitude";

	public interface OnWebServiceCompleteListener {
		void onPostExecute(Object result);
	}

	/**
	 * 登录
	 * 
	 * @param loginId
	 * @param pwd
	 * @return certificateToken
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object login(String loginId, String pwd) throws IOException,
			XmlPullParserException {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("loginID", loginId);
		map.put("pwd", pwd);

		Object response = callWebService(BASE_URL, NAMESPACE, METHOD_SYS_LOGIN,
				map, null, null);

		return response;
	}

	/**
	 * 注册帐号
	 * 
	 * @param userid
	 * @param password
	 * @param username
	 * @param mobile
	 * @param userType
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object sysRegister(String userid, String password, String username,
			String mobile, String userType) throws IOException,
			XmlPullParserException {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("userid", userid);
		map.put("password", password);
		map.put("username", username);
		map.put("mobile", mobile);
		map.put("userType", userType);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_SYS_REGISTER, map, null, null);
		return response;
	}

	/**
	 * 激活帐号
	 * 
	 * @param userid
	 * @param randomRegisterCode
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object sysActive(String userid, String randomRegisterCode)
			throws IOException, XmlPullParserException {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("userid", userid);
		map.put("randomRegisterCode", randomRegisterCode);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_SYS_ACTIVE, map, null, null);
		return response;
	}

	/**
	 * 注销登录
	 * 
	 * @param certificate
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object sysLogout(Certificate certificate) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_SYS_LOGOUT, null, properties, null);
		return response;
	}

	/**
	 * 发布专线
	 * 
	 * @param certificate
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param daysDuringJourney
	 * @param daysTruckSchedule
	 * @param price1
	 * @param price2
	 * @param lineName
	 * @param startLocationAddress
	 * @param startLocationContact
	 * @param startLocationMobile
	 * @param startLocationTel
	 * @param endLocationAddress
	 * @param endLocationContact
	 * @param endLocationMobile
	 * @param endLocationTel
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonPublishSpecialLine(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String startLocationLv3, String endLocationLv1,
			String endLocationLv2, String endLocationLv3,
			String daysDuringJourney, String daysTruckSchedule, String price1,
			String price2, String lineName, String startLocationAddress,
			String startLocationContact, String startLocationMobile,
			String startLocationTel, String endLocationAddress,
			String endLocationContact, String endLocationMobile,
			String endLocationTel) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("startLocationLv3", startLocationLv3);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("endLocationLv3", endLocationLv3);
		map.put("daysDuringJourney", Integer.valueOf(daysDuringJourney));
		map.put("daysTruckSchedule", Integer.valueOf(daysTruckSchedule));
		if (!TextUtils.isEmpty(price1)) {
			map.put("price1", BigDecimal.valueOf(Double.valueOf(price1)));
		}
		if (!TextUtils.isEmpty(price2)) {
			map.put("price2", BigDecimal.valueOf(Double.valueOf(price2)));
		}
		map.put("lineName", lineName);
		map.put("startLocationAddress", startLocationAddress);
		map.put("startLocationContact", startLocationContact);
		map.put("startLocationMobile", startLocationMobile);
		map.put("startLocationTel", startLocationTel);
		map.put("endLocationAddress", endLocationAddress);
		map.put("endLocationContact", endLocationContact);
		map.put("endLocationMobile", endLocationMobile);
		map.put("endLocationTel", endLocationTel);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_PUBLISH_SPECIAL_LINE, map, properties, null);
	}

	/**
	 * 发布车讯
	 * 
	 * @param userLoginId
	 * @param certificateToken
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param comment
	 * @param setOffDate
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 * @throws ParseException
	 */
	public Object driverPublishTrunckMessage(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String startLocationLv3, String endLocationLv1,
			String endLocationLv2, String endLocationLv3, String comment,
			String setOffDate) throws IOException, XmlPullParserException,
			ParseException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("startLocationLv3", startLocationLv3);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("endLocationLv3", endLocationLv3);
		map.put("comment", comment);
		if (!TextUtils.isEmpty(setOffDate)) {
			map.put("setOffDate", sDateFormat.parse(setOffDate));
		}

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_DRIVER_PUBLISH_TRUCK_MESSAGE, map, properties, null);
	}

	/**
	 * 获取我的车型列表
	 * 
	 * @param certificate
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object driverGetMyTruck(Certificate certificate) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		return callWebService(BASE_URL, NAMESPACE, METHOD_COMMON_GET_MY_TRUCK,
				null, properties, null);
	}

	/**
	 * 发布货讯
	 * 
	 * @param userLoginId
	 * @param certificateToken
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param freightName
	 * @param freightTonnage
	 * @param freightTruckLengthRequired
	 * @param freightTruckTypeRequired
	 * @param freightTruckAmountRequired
	 * @param contactName
	 * @param contactPhone
	 * @param attention
	 * @param setOffDate
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 * @throws ParseException
	 */
	public Object companyPublicFreightMessage(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String startLocationLv3, String endLocationLv1,
			String endLocationLv2, String endLocationLv3, String freightName,
			String freightTonnage, String freightTruckLengthRequired,
			String freightTruckTypeRequired, String freightTruckAmountRequired,
			String contactName, String contactPhone, String attention,
			String setOffDate, String freightUnit) throws IOException,
			XmlPullParserException, ParseException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("startLocationLv3", startLocationLv3);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("endLocationLv3", endLocationLv3);
		map.put("freightName", freightName);
		try {
			map.put("freightTonnage",
					BigDecimal.valueOf(Double.valueOf(freightTonnage)));
		} catch (Exception e) {
		}
		if (TextUtils.isEmpty(freightTruckLengthRequired)) {
			freightTruckLengthRequired = "0";
		}
		map.put("freightTruckLengthRequired",
				BigDecimal.valueOf(Double.valueOf(freightTruckLengthRequired)));
		map.put("freightTruckTypeRequired", freightTruckTypeRequired);
		map.put("freightTruckAmountRequired",
				Integer.valueOf(freightTruckAmountRequired));
		map.put("contactName", contactName);
		map.put("contactPhone", contactPhone);
		map.put("attention", attention);
		map.put("freightUnit", freightUnit);
		if (!TextUtils.isEmpty(setOffDate)) {
			map.put("setOffDate", sDateFormat.parse(setOffDate));
		}

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMPANY_PUBLISH_FREIGHT_MESSAGE, map, properties, null);
	}

	/**
	 * 找货讯（异步）
	 * 
	 * @param userLoginId
	 * @param certificateToken
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param freightName
	 * @param freightTonnage
	 * @param freightTonnageSymbol
	 * @param freightTruckLengthRequired
	 * @param freightTruckLengthRequiredSymbol
	 * @param setOffDate
	 * @param setOffDateSymbol
	 * @param l
	 */
	public void commonFindFreightMessageAsync(final Certificate certificate,
			final String startLocationLv1, final String startLocationLv2,
			final String startLocationLv3, final String endLocationLv1,
			final String endLocationLv2, final String endLocationLv3,
			final String freightName, final String freightTonnage,
			final String freightTonnageSymbol,
			final String freightTruckLengthRequired,
			final String freightTruckLengthRequiredSymbol,
			final String setOffDate, final String setOffDateSymbol,
			final int currentPage, final int pageSize,
			final OnWebServiceCompleteListener l) {
		new AsyncTask<Void, Void, Object>() {
			ProgressDialog mDialog;

			@Override
			protected void onPreExecute() {
				mDialog = ProgressDialog.show(mContext, "", "加载中");
			};

			@Override
			protected void onPostExecute(Object result) {
				if (l != null) {
					l.onPostExecute(result);
				}
				mDialog.dismiss();
			}

			@Override
			protected Object doInBackground(Void... params) {
				try {
					return commonFindFreigthMessage(certificate,
							startLocationLv1, startLocationLv2,
							startLocationLv3, endLocationLv1, endLocationLv2,
							endLocationLv3, freightName, freightTonnage,
							freightTonnageSymbol, freightTruckLengthRequired,
							freightTruckLengthRequiredSymbol, setOffDate,
							setOffDateSymbol, currentPage, pageSize);
				} catch (IOException e) {
					e.printStackTrace();
					return e;
				} catch (XmlPullParserException e) {
					e.printStackTrace();
					return e;
				}
			}
		}.execute();
	}

	/**
	 * 找货讯
	 * 
	 * @param userLoginId
	 * @param certificateToken
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param freightName
	 * @param freightTonnage
	 * @param freightTonnageSymbol
	 * @param freightTruckLengthRequired
	 * @param freightTruckLengthRequiredSymbol
	 * @param setOffDate
	 * @param setOffDateSymbol
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindFreigthMessage(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String startLocationLv3, String endLocationLv1,
			String endLocationLv2, String endLocationLv3, String freightName,
			String freightTonnage, String freightTonnageSymbol,
			String freightTruckLengthRequired,
			String freightTruckLengthRequiredSymbol, String setOffDate,
			String setOffDateSymbol, int currentPage, int pageSize)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("startLocationLv3", startLocationLv3);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("endLocationLv3", endLocationLv3);
		map.put("freightName", freightName);
		map.put("freightTonnage", BigDecimal.ONE);
		map.put("freightTonnageSymbol", freightTonnageSymbol);
		map.put("freightTruckLengthRequired", BigDecimal.ONE);
		map.put("freightTruckLengthRequiredSymbol",
				freightTruckLengthRequiredSymbol);
		map.put("setOffDate", new Date());
		map.put("setOffDateSymbol", setOffDateSymbol);
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_FREIGHT_MESSAGE, map, properties, null);
	}

	/**
	 * 找车讯（异步）
	 * 
	 * @param userLoginId
	 * @param certificateToken
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param truckType
	 * @param truckTonnage
	 * @param truckTonnageSymBol
	 * @param truckLength
	 * @param truckLengthSymbol
	 * @param setOffDate
	 * @param setOffDateSymbol
	 * @param l
	 */
	public void commonFindTrunkMessageAsync(final Certificate certificate,
			final String startLocationLv1, final String startLocationLv2,
			final String startLocationLv3, final String endLocationLv1,
			final String endLocationLv2, final String endLocationLv3,
			final String truckType, final String truckTonnage,
			final String truckTonnageSymBol, final String truckLength,
			final String truckLengthSymbol, final String setOffDate,
			final String setOffDateSymbol, final int currentPage,
			final int pageSize, final OnWebServiceCompleteListener l) {
		new AsyncTask<Void, Void, Object>() {
			ProgressDialog mDialog;

			@Override
			protected void onPreExecute() {
				mDialog = ProgressDialog.show(mContext, "", "加载中");
			};

			@Override
			protected void onPostExecute(Object result) {
				if (l != null) {
					l.onPostExecute(result);
				}
				mDialog.dismiss();
			}

			@Override
			protected Object doInBackground(Void... params) {
				try {
					return commonFindTrunkMessage(certificate,
							startLocationLv1, startLocationLv2,
							startLocationLv3, endLocationLv1, endLocationLv2,
							endLocationLv3, truckType, truckTonnage,
							truckTonnageSymBol, truckLength, truckLengthSymbol,
							setOffDate, setOffDateSymbol, currentPage, pageSize);
				} catch (IOException e) {
					e.printStackTrace();
					return e;
				} catch (XmlPullParserException e) {
					e.printStackTrace();
					return e;
				}
			}
		}.execute();
	}

	/**
	 * 找车讯
	 * 
	 * @param userLoginId
	 * @param certificateToken
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param truckType
	 * @param truckTonnage
	 * @param truckTonnageSymBol
	 * @param truckLength
	 * @param truckLengthSymbol
	 * @param setOffDate
	 * @param setOffDateSymbol
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindTrunkMessage(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String startLocationLv3, String endLocationLv1,
			String endLocationLv2, String endLocationLv3, String truckType,
			String truckTonnage, String truckTonnageSymBol, String truckLength,
			String truckLengthSymbol, String setOffDate,
			String setOffDateSymbol, int currentPage, int pageSize)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("startLocationLv3", startLocationLv3);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("endLocationLv3", endLocationLv3);
		map.put("truckType", truckType);
		try {
			map.put("truckTonnage",
					BigDecimal.valueOf(Double.valueOf(truckTonnage)));
		} catch (Exception e) {
		}
		map.put("truckTonnageSymBol", truckTonnageSymBol);
		try {
			map.put("truckLength",
					BigDecimal.valueOf(Double.valueOf(truckLength)));
		} catch (Exception e) {
		}
		map.put("truckLengthSymbol", truckLengthSymbol);
		if (!TextUtils.isEmpty(setOffDate)) {
			try {
				map.put("setOffDate", sDateFormat.parse(setOffDate));
			} catch (ParseException e) {
				e.printStackTrace();
			}
		}
		map.put("setOffDateSymbol", setOffDateSymbol);
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_TRUNK_MESSAGE, map, properties, null);
		// SoapObject so = (SoapObject) response;
		// for (int i = 0; i < so.getPropertyCount(); i++) {
		// Log.d(TAG, "pi: " + so.getProperty(i) + ", pi type: "
		// + so.getProperty(i).getClass().getSimpleName());
		// SoapObject soChild = (SoapObject) so.getProperty(i);
		// for (int j = 0; j < soChild.getPropertyCount(); j++) {
		// Log.d(TAG, "soChild.getProperty: " + soChild.getProperty(j)
		// + ", piChild type: "
		// + soChild.getProperty(j).getClass().getSimpleName());
		// }
		// }

		return response;
	}

	/**
	 * 找车
	 * 
	 * @param certificate
	 * @param currentLocationLv1
	 * @param currentLocationLv2
	 * @param currentLocationLv3
	 * @param driverName
	 * @param driverMobile
	 * @param ownerName
	 * @param ownerMobile
	 * @param truckType
	 * @param truckTonnage
	 * @param truckTonnageSymBol
	 * @param truckLength
	 * @param truckLengthSymbol
	 * @param currentPage
	 * @param pageSize
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindTrunk(Certificate certificate,
			String currentLocationLv1, String currentLocationLv2,
			String currentLocationLv3, String driverName, String driverMobile,
			String ownerName, String ownerMobile, String truckType,
			String truckTonnage, String truckTonnageSymBol, String truckLength,
			String truckLengthSymbol, int currentPage, int pageSize)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("currentLocationLv1", currentLocationLv1);
		map.put("currentLocationLv2", currentLocationLv2);
		map.put("currentLocationLv3", currentLocationLv3);
		map.put("driverName", driverName);
		map.put("driverMobile", driverMobile);
		map.put("ownerName", ownerName);
		map.put("ownerMobile", ownerMobile);
		map.put("truckType", truckType);
		try {
			map.put("truckTonnage",
					BigDecimal.valueOf(Double.valueOf(truckTonnage)));
		} catch (Exception e) {
		}
		map.put("truckTonnageSymBol", truckTonnageSymBol);
		try {
			map.put("truckLength",
					BigDecimal.valueOf(Double.valueOf(truckLength)));
		} catch (Exception e) {
		}
		map.put("truckLengthSymbol", truckLengthSymbol);
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_TRUCK, map, properties, null);
		return response;
	}

	/**
	 * 获取车详细信息
	 * 
	 * @param certificate
	 * @param id
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindTrunkDetail(Certificate certificate, long id)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("truckId", id);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_TRUCK_DETAIL, map, properties, null);
	}

	/**
	 * 查找物流公司
	 * 
	 * @param certificate
	 * @param locationLv1
	 * @param locationLv2
	 * @param locationLv3
	 * @param name
	 * @param contact
	 * @param tel
	 * @param mobile
	 * @param currentPage
	 * @param pageSize
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindLogisticCompanys(Certificate certificate,
			String locationLv1, String locationLv2, String locationLv3,
			String name, String contact, String tel, String mobile,
			int currentPage, int pageSize) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("locationLv1", locationLv1);
		map.put("locationLv2", locationLv2);
		map.put("locationLv3", locationLv3);
		map.put("name", name);
		map.put("contact", contact);
		map.put("tel", tel);
		map.put("mobile", mobile);
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_COMPANY, map, properties, null);
		return response;
	}

	/**
	 * 获取物流公司详细信息
	 * 
	 * @param certificate
	 * @param id
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindLogisticCompanyDetail(Certificate certificate,
			long id) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("companyID", id);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_COMPANY_DETAIL, map, properties, null);
	}

	/**
	 * 找专线
	 * 
	 * @param certificate
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param daysDuringJourney
	 * @param daysTruckSchedule
	 * @param price1
	 * @param price2
	 * @param currentPage
	 * @param pageSize
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindSpecialLines(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String startLocationLv3, String endLocationLv1,
			String endLocationLv2, String endLocationLv3,
			String daysDuringJourney, String daysTruckSchedule, String price1,
			String price2, int currentPage, int pageSize) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("startLocationLv3", startLocationLv3);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("endLocationLv3", endLocationLv3);
		try {
			map.put("daysDuringJourney", Integer.valueOf(daysDuringJourney));
		} catch (Exception e) {
		}
		try {
			map.put("daysTruckSchedule", Integer.valueOf(daysTruckSchedule));
		} catch (Exception e) {
		}
		try {
			map.put("price1", BigDecimal.valueOf(Double.valueOf(price1)));
		} catch (Exception e) {
		}
		try {
			map.put("price2", BigDecimal.valueOf(Double.valueOf(price2)));
		} catch (Exception e) {
		}
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_SPECIAL_LINES, map, properties, null);
		return response;
	}

	/**
	 * 获取单个车讯信息
	 * 
	 * @param certificate
	 * @param id
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindTruckMessageDetail(Certificate certificate, long id)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("truckMessageId", id);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_TRUCK_MESSAGE_DETAIL, map, properties, null);
	}

	/**
	 * 获取单个货讯信息
	 * 
	 * @param certificate
	 * @param id
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindFreightMessageDetail(Certificate certificate,
			long id) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("freightMessageId", id);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_FREIGHT_MESSAGE_DETAIL, map, properties,
				null);
	}

	/**
	 * 找单个专线信息
	 * 
	 * @param certificate
	 * @param id
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindSpecialLineDetail(Certificate certificate, long id)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("lineID", id);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_SPECIAL_LINE_DETAIL, map, properties, null);
	}

	/**
	 * 获取车型列表
	 * 
	 * @param certificate
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commomGetTruckList(Certificate certificate)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_GET_TRUCK_LIST, null, properties, null);
	}

	/**
	 * 获取我的位置
	 * 
	 * @param userLoginId
	 * @param certificateToken
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonGetMyCurrentPlace(Certificate certificate)
			throws IOException, XmlPullParserException {
		HashMap<String, Object> map = new HashMap<String, Object>();
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		SharedPreferences sp = mContext.getSharedPreferences("location",
				Context.MODE_PRIVATE);
		String token = sp.getString("certificate", null);
		long timestamp = sp.getLong("timestap", -1);
		if (TextUtils.isEmpty(token) || timestamp == -1
				|| System.currentTimeMillis() - timestamp > 1000 * 60 * 60
				|| !certificate.certifcateToken.equals(token)) {
			Object object = callWebService(BASE_URL, NAMESPACE,
					METHOD_COMMON_GET_MY_CURRENT_PLACE, map, properties, null);
			SoapObject so = (SoapObject) object;
			String lv1 = so.getProperty(0).toString();
			String lv2 = so.getProperty(1).toString();
			String lv3 = so.getProperty(2).toString();
			sp.edit().putString("lv1", lv1).putString("lv2", lv2)
					.putString("lv3", lv3).commit();
			sp.edit().putString("certificate", certificate.certifcateToken)
					.putLong("timestap", System.currentTimeMillis()).commit();
			return object;
		} else {
			String lv1 = sp.getString("lv1", null);
			String lv2 = sp.getString("lv2", null);
			String lv3 = sp.getString("lv3", null);
			if (lv1 == null || lv2 == null || lv3 == null) {
				throw new IOException();
			}
			SoapObject so = new SoapObject("", "");
			so.addProperty("lv1", lv1);
			so.addProperty("lv2", lv2);
			so.addProperty("lv3", lv3);

			return so;
		}
	}

	/**
	 * 获取我的个人信息
	 * 
	 * @param userLoginId
	 * @param certificateToken
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonGetPersonalInfo(Certificate certificate)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		HashMap<String, Object> map = new HashMap<String, Object>();
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_GET_PERSONAL_INFO, map, properties, null);
		return response;
	}

	/**
	 * 获取我的收藏分组
	 * 
	 * @param certificate
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonGetMyStoreGroups(Certificate certificate)
			throws IOException, XmlPullParserException {
		HashMap<String, Object> map = new HashMap<String, Object>();
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_GET_MY_STORE_GROUPS, map, properties, null);
		return response;
	}

	/**
	 * 添加收藏分组
	 * 
	 * @param certificate
	 * @param groupName
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonModifyStoreGroupAdd(Certificate certificate,
			String groupName) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("groupName", groupName);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_MODIFY_STORE_GROUP_ADD, map, properties, null);
		return response;
	}

	/**
	 * 更改收藏分组
	 * 
	 * @param certificate
	 * @param groupID
	 * @param oldGroupName
	 * @param newGroupName
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonModifyStoreGroupUpdate(Certificate certificate,
			String groupID, String oldGroupName, String newGroupName)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("groupID", Integer.valueOf(groupID));
		map.put("oldGroupName", oldGroupName);
		map.put("newGroupName", newGroupName);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_MODIFY_STORE_GROUP_UPDATE, map, properties, null);
		return response;
	}

	/**
	 * 删除收藏分组
	 * 
	 * @param certificate
	 * @param groupID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonModifyStoreGroupDelete(Certificate certificate,
			String groupID) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("groupID", Integer.valueOf(groupID));

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_MODIFY_STORE_GROUP_DELETE, map, properties, null);
		return response;
	}

	/**
	 * 移动收藏
	 * 
	 * @param certificate
	 * @param stroreID
	 * @param originStoreGroupID
	 * @param newStoreGroupID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonModifyStoreGroupMoveItemToAnotherGroup(
			Certificate certificate, String stroreID,
			String originStoreGroupID, String newStoreGroupID)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("stroreID", Integer.valueOf(stroreID));
		map.put("originStoreGroupID", originStoreGroupID);
		map.put("newStoreGroupID", newStoreGroupID);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_MODIFY_STORE_GROUP_MOVE_ITEM_TO_ANOTHER_GROUP,
				map, properties, null);
		return response;
	}

	/**
	 * 删除收藏
	 * 
	 * @param certificate
	 * @param stroreID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonModifyStoreGroupRemoveItem(Certificate certificate,
			String stroreID) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("stroreID", Integer.valueOf(stroreID));

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_MODIFY_STORE_GROUP_REMOVE_ITEM, map, properties,
				null);
		return response;
	}

	/**
	 * 添加车收藏
	 * 
	 * @param certificate
	 * @param truckID
	 * @param groupID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object companyModifyStoreGroupAddTruckToGroup(
			Certificate certificate, String truckID, String groupID)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("truckID", Integer.valueOf(truckID));
		map.put("groupID", Integer.valueOf(groupID));

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMPANY_MODIFY_STORE_GROUP_ADD_TRUCK_TO_GROUP, map,
				properties, null);
		return response;
	}

	/**
	 * 获取我收藏的车
	 * 
	 * @param certificate
	 * @param groupID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object companyStoreGroupGetMyStoredTrucks(Certificate certificate,
			String groupID) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		if (!TextUtils.isEmpty(groupID)) {
			map.put("groupID", Integer.valueOf(groupID));
		}

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMPANY_STORE_GROUP_GET_MY_STORED_TRUCKS, map,
				properties, null);
		return response;
	}

	public class DocumentIDs extends Vector<String> implements KvmSerializable {
		private static final long serialVersionUID = -1166006770093411055L;

		@Override
		public Object getProperty(int arg0) {
			return this.get(arg0);
		}

		@Override
		public int getPropertyCount() {
			return this.size();
		}

		@Override
		public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo arg2) {
			arg2.name = "string";
			arg2.type = PropertyInfo.STRING_CLASS;
		}

		@Override
		public void setProperty(int arg0, Object arg1) {
			this.add(arg1.toString());
		}
	}

	/**
	 * 
	 * @param certificate
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param freightName
	 * @param freightTonnage
	 * @param freightTonnageSymbol
	 * @param freightTruckLengthRequired
	 * @param freightTruckLengthRequiredSymbol
	 * @param setOffDate
	 * @param setOffDateSymbol
	 * @param currentPage
	 * @param pageSize
	 * @param freightStatus
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object companyFindMyFreightMessage(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String startLocationLv3, String endLocationLv1,
			String endLocationLv2, String endLocationLv3, String freightName,
			String freightTonnage, String freightTonnageSymbol,
			String freightTruckLengthRequired,
			String freightTruckLengthRequiredSymbol, String setOffDate,
			String setOffDateSymbol, int currentPage, int pageSize,
			String[] freightStatus) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		if (freightStatus != null) {
			DocumentIDs documentIdVector = new DocumentIDs();
			for (int i = 0; i < freightStatus.length; i++) {
				documentIdVector.add(freightStatus[i]);
			}
			PropertyInfo freightStatusPropertyInfo = new PropertyInfo();
			freightStatusPropertyInfo.setName("freightStatus");
			freightStatusPropertyInfo.setValue(documentIdVector);
			freightStatusPropertyInfo.setType(documentIdVector.getClass());
			properties.add(freightStatusPropertyInfo);
		}

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("startLocationLv3", startLocationLv3);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("endLocationLv3", endLocationLv3);
		map.put("freightName", freightName);
		map.put("freightTonnage", BigDecimal.ONE);
		map.put("freightTonnageSymbol", freightTonnageSymbol);
		map.put("freightTruckLengthRequired", BigDecimal.ONE);
		map.put("freightTruckLengthRequiredSymbol",
				freightTruckLengthRequiredSymbol);
		map.put("setOffDate", new Date());
		map.put("setOffDateSymbol", setOffDateSymbol);
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMPANY_FIND_MY_FREIGHT_MESSAGE, map, properties, null);
	}

	/**
	 * 
	 * @param certificate
	 * @param truckID
	 * @param ShipperContactPerson
	 * @param ShipperTel
	 * @param ShipperAddress
	 * @param Consignee
	 * @param ConsigneeContactPerson
	 * @param ConsigneeTel
	 * @param ConsigneeAddress
	 * @param CargosDescription
	 * @param CargosNature
	 * @param Packing
	 * @param Quantity
	 * @param Weight
	 * @param Value
	 * @param TimeLimits
	 * @param ShippingCost
	 * @param Merchandiser
	 * @param MerchandiserTel
	 * @param Remarks
	 * @param useNotarize
	 * @param useShippingCostGuarantee
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object companyCreateOrder(Certificate certificate, String truckID,
			String freightMessageId, String Shipper,
			String ShipperContactPerson, String ShipperTel,
			String ShipperAddress, String Consignee,
			String ConsigneeContactPerson, String ConsigneeTel,
			String ConsigneeAddress, String CargosDescription,
			String CargosNature, String Packing, String Quantity,
			String Weight, String Value, String TimeLimits,
			String ShippingCost, String Merchandiser, String MerchandiserTel,
			String Remarks, boolean useNotarize,
			boolean useShippingCostGuarantee) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("truckID", truckID);
		map.put("freightMessageId", freightMessageId);
		map.put("Shipper", Shipper);
		map.put("ShipperContactPerson", ShipperContactPerson);
		map.put("ShipperTel", ShipperTel);
		map.put("ShipperAddress", ShipperAddress);
		map.put("Consignee", Consignee);
		map.put("ConsigneeContactPerson", ConsigneeContactPerson);
		map.put("ConsigneeTel", ConsigneeTel);
		map.put("ConsigneeAddress", ConsigneeAddress);
		map.put("CargosDescription", CargosDescription);
		map.put("CargosNature", CargosNature);
		map.put("Packing", Packing);
		try {
			map.put("Quantity", Integer.valueOf(Quantity));
		} catch (Exception e) {
		}
		try {
			map.put("Weight", BigDecimal.valueOf(Double.valueOf(Weight)));
		} catch (Exception e) {
		}
		try {
			map.put("Value", BigDecimal.valueOf(Double.valueOf(Value)));
		} catch (Exception e) {
		}
		try {
			map.put("TimeLimits", sDateFormat.parse(TimeLimits));
		} catch (Exception e) {
		}
		try {
			map.put("ShippingCost",
					BigDecimal.valueOf(Double.valueOf(ShippingCost)));
		} catch (Exception e) {
		}
		map.put("Merchandiser", Merchandiser);
		map.put("MerchandiserTel", MerchandiserTel);
		map.put("Remarks", Remarks);
		try {
			map.put("useNotarize", Boolean.valueOf(useNotarize));
		} catch (Exception e) {
		}
		try {
			map.put("useShippingCostGuarantee",
					Boolean.valueOf(useShippingCostGuarantee));
		} catch (Exception e) {
		}

		return callWebService(BASE_URL, NAMESPACE, METHOD_COMPANY_CREATE_ORDER,
				map, properties, null);
	}

	/**
	 * 
	 * @param certificate
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param startLocationLv3
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param endLocationLv3
	 * @param freightMessageId
	 * @param CargosDescription
	 * @param driverName
	 * @param plateNumber
	 * @param driverTel
	 * @param Merchandiser
	 * @param MerchandiserTel
	 * @param tonnage
	 * @param truckTonnageSymBol
	 * @param acceptDateStart
	 * @param acceptDateEnd
	 * @param currentPage
	 * @param pageSize
	 * @param orderStatus
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object companyGetMyOrders(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String startLocationLv3, String endLocationLv1,
			String endLocationLv2, String endLocationLv3,
			String freightMessageId, String CargosDescription,
			String driverName, String plateNumber, String driverTel,
			String Merchandiser, String MerchandiserTel, String tonnage,
			String truckTonnageSymBol, String acceptDateStart,
			String acceptDateEnd, int currentPage, int pageSize,
			String[] orderStatus) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		DocumentIDs documentIdVector = new DocumentIDs();
		if (orderStatus != null) {
			for (int i = 0; i < orderStatus.length; i++) {
				documentIdVector.add(orderStatus[i]);
			}
		}
		PropertyInfo freightStatusPropertyInfo = new PropertyInfo();
		freightStatusPropertyInfo.setName("orderStatus");
		freightStatusPropertyInfo.setValue(documentIdVector);
		freightStatusPropertyInfo.setType(documentIdVector.getClass());
		properties.add(freightStatusPropertyInfo);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("startLocationLv3", startLocationLv3);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("endLocationLv3", endLocationLv3);
		map.put("CargosDescription", CargosDescription);
		map.put("driverName", driverName);
		map.put("plateNumber", plateNumber);
		map.put("driverTel", driverTel);
		map.put("Merchandiser", Merchandiser);
		map.put("MerchandiserTel", MerchandiserTel);
		try {
			map.put("tonnage", BigDecimal.valueOf(Double.valueOf(tonnage)));
		} catch (Exception e) {
		}
		map.put("truckTonnageSymBol", truckTonnageSymBol);
		try {
			map.put("acceptDateStart", sDateFormat.parse(acceptDateStart));
			map.put("acceptDateEnd", sDateFormat.parse(acceptDateEnd));
		} catch (ParseException e) {
		}
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMPANY_GET_MY_ORDERS, map, properties, null);
	}

	/**
	 * 添加货讯收藏
	 * 
	 * @param certificate
	 * @param freightMessageId
	 * @param groupID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object driverModifyStoreGroupAddFreightMessageToGroup(
			Certificate certificate, String freightMessageId, String groupID)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("groupID", Integer.valueOf(groupID));
		map.put("freightMessageId", freightMessageId);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_DRIVER_MODIFY_STORE_GROUP_ADD_FREIGHT_MESSAGE_TO_GROUP,
				map, properties, null);
		return response;
	}

	/**
	 * 获取我的货讯收藏
	 * 
	 * @param certificate
	 * @param groupID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object driverStoreGroupGetMyStoredFreightMessage(
			Certificate certificate, String groupID) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		if (!TextUtils.isEmpty(groupID)) {
			map.put("groupID", Integer.valueOf(groupID));
		}

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_DRIVER_STORE_GROUP_GET_MY_STORED_FREIGHT_MESSAGE, map,
				properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param groupID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonStoreGroupGetMyStoredSpecialLines(
			Certificate certificate, String groupID) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		if (!TextUtils.isEmpty(groupID)) {
			map.put("groupID", Integer.valueOf(groupID));
		}

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_STORE_GROUP_GET_MY_STORED_SPECIAL_LINES, map,
				properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param specialLineID
	 * @param groupID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonStoreGroupAddSpecialLineToGroup(
			Certificate certificate, String specialLineID, String groupID)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("groupID", Integer.valueOf(groupID));
		map.put("specialLineID", specialLineID);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_STORE_GROUP_ADD_SPECIAL_LINE_TO_GROUP, map,
				properties, null);
		return response;
	}

	/**
	 * 找优惠，找附近
	 * 
	 * @param certificate
	 * @param myLongitude
	 * @param myLatitude
	 * @param radius
	 * @param mapType
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonFindMapLocation(Certificate certificate,
			String myLongitude, String myLatitude, String radius, String mapType)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("myLongitude", Float.valueOf(myLongitude));
		map.put("myLatitude", Float.valueOf(myLatitude));
		map.put("radius", Float.valueOf(radius));
		map.put("mapType", mapType);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_FIND_MAP_LOCATION, map, properties, null);
	}

	/**
	 * 获取用户是否有新的内部消息
	 * 
	 * @param userLoginId
	 * @param certificateToken
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object requireNewInternalMessage(Certificate certificate)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_SYS_REQUIRE_NEW_INTERNAL_MESSAGE, null, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object commonGetMyInternalMessage(Certificate certificate)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMMON_GETMY_INTERNAL_MESSAGE, null, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param subscribeID
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param type
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object common_modifySubscribe(Certificate certificate,
			long subscribeID, String startLocationLv1, String startLocationLv2,
			String endLocationLv1, String endLocationLv2, String type)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("subscribeID", Long.valueOf(subscribeID));
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("type", type);

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMMON_MODIFY_SUBSCRIBE, map, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param startLocationLv1
	 * @param startLocationLv2
	 * @param endLocationLv1
	 * @param endLocationLv2
	 * @param type
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object common_addSubscribe(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String endLocationLv1, String endLocationLv2, String type)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("type", type);

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMMON_ADD_SUBSCRIBE, map, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param subscribeID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object common_deleteSubscribe(Certificate certificate,
			long subscribeID) throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("subscribeID", Long.valueOf(subscribeID));

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMMON_DELETE_SUBSCRIBE, map, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object common_getMySubscribe(Certificate certificate)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMMON_GET_MY_SUBSCRIBE, null, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param id
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object driver_CarInfo(Certificate certificate, String id)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("carInfoID", Long.valueOf(id));

		Object response = callWebService(BASE_URL, NAMESPACE,
				DRIVER_CARINFOSATATUS, map, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param id
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object company_CargosInfo(Certificate certificate, String id)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("cargosInfo", Long.valueOf(id));

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMPANY_CARGOSINFOSTATUS, map, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param currentPage
	 * @param pageSize
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object driver_getMyCarInfo(Certificate certificate, int currentPage,
			int pageSize) throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		Object response = callWebService(BASE_URL, NAMESPACE,
				DRIVER_GETMYCARINFO, map, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param currentPage
	 * @param pageSize
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object company_findMyMessage(Certificate certificate,
			int currentPage, int pageSize) throws IOException,
			XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMPANY_FINDMYMESSAGE, map, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param userID
	 * @param currentPage
	 * @param pageSize
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object company_findSpecialLines(Certificate certificate,
			String userID, int currentPage, int pageSize) throws IOException,
			XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("userID", Long.valueOf(userID));
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMPANY_FINDSPECIALLINES, map, properties, null);
		return response;
	}

	/**
	 * @param certificate
	 * @param userID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object common_findUserInfo(Certificate certificate, String userID)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("userID", Long.valueOf(userID));

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMMON_FINDUSERINFO, map, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @param userID
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object common_findUserOrderInfo(Certificate certificate,
			String userID) throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("userID", Long.valueOf(userID));

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMMON_FINDUSERORDERINFO, map, properties, null);
		return response;
	}

	/**
	 * 
	 * @param certificate
	 * @return
	 * @throws IOException
	 * @throws XmlPullParserException
	 */
	public Object common_AutoUpdate(Certificate certificate)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		Object response = callWebService(BASE_URL, NAMESPACE,
				COMMON_AUTOUPDATE, null, properties, null);
		return response;
	}

	public Object driver_getMyOrders(Certificate certificate,
			String startLocationLv1, String startLocationLv2,
			String startLocationLv3, String endLocationLv1,
			String endLocationLv2, String endLocationLv3,
			String CargosDescription, String LogisticCompanyName,
			String contactTel, String tonnage, String truckTonnageSymBol,
			String acceptDateStart, String acceptDateEnd, int currentPage,
			int pageSize, String[] orderStatus) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		DocumentIDs documentIdVector = new DocumentIDs();
		for (int i = 0; i < orderStatus.length; i++) {
			documentIdVector.add(orderStatus[i]);
		}
		PropertyInfo freightStatusPropertyInfo = new PropertyInfo();
		freightStatusPropertyInfo.setName("orderStatus");
		freightStatusPropertyInfo.setValue(documentIdVector);
		freightStatusPropertyInfo.setType(documentIdVector.getClass());
		properties.add(freightStatusPropertyInfo);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("startLocationLv1", startLocationLv1);
		map.put("startLocationLv2", startLocationLv2);
		map.put("startLocationLv3", startLocationLv3);
		map.put("endLocationLv1", endLocationLv1);
		map.put("endLocationLv2", endLocationLv2);
		map.put("endLocationLv3", endLocationLv3);
		map.put("CargosDescription", CargosDescription);
		map.put("LogisticCompanyName", LogisticCompanyName);
		map.put("contactTel", contactTel);
		try {
			map.put("tonnage", BigDecimal.valueOf(Double.valueOf(tonnage)));
		} catch (Exception e) {
		}
		map.put("truckTonnageSymBol", truckTonnageSymBol);
		try {
			map.put("acceptDateStart", sDateFormat.parse(acceptDateStart));
			map.put("acceptDateEnd", sDateFormat.parse(acceptDateEnd));
		} catch (ParseException e) {
		}
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		return callWebService(BASE_URL, NAMESPACE, DRIVER_GETMYORDERS, map,
				properties, null);
	}

	public Object company_getMyOrderView(Certificate certificate, String orderID)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("orderID", Long.valueOf(orderID));

		Object response = callWebService(BASE_URL, NAMESPACE,
				METHOD_COMPANY_GET_MY_ORDER_VIEW, map, properties, null);
		return response;
	}

	public Object driver_getMyOrderView(Certificate certificate, String orderID)
			throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("orderID", Long.valueOf(orderID));

		Object response = callWebService(BASE_URL, NAMESPACE,
				DRIVER_GETMYORDERVIEW, map, properties, null);
		return response;
	}

	public Object company_Status(Certificate certificate, String orderID,
			String status) throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("orderID", Long.valueOf(orderID));
		map.put("status", status);

		Object response = callWebService(BASE_URL, NAMESPACE, COMPANY_STATUS,
				map, properties, null);
		return response;
	}

	public Object driver_Status(Certificate certificate, String orderID,
			String status) throws IOException, XmlPullParserException {
		if (certificate == null) {
			return null;
		}

		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("orderID", Long.valueOf(orderID));
		map.put("status", status);

		Object response = callWebService(BASE_URL, NAMESPACE, DRIVER_STATUS,
				map, properties, null);
		return response;
	}

	public Object company_getMyTruck(Certificate certificate, String no,
			String driver, String driverTel) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("no", String.valueOf(no));
		map.put("driver", String.valueOf(driver));
		map.put("driverTel", String.valueOf(driverTel));

		return callWebService(BASE_URL, NAMESPACE, COMPANY_GETMYTRUCK, map,
				properties, null);
	}

	public Object company_getMyTruckByID(Certificate certificate, String id)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("id", Long.valueOf(id));

		return callWebService(BASE_URL, NAMESPACE, COMPANY_GETMYTRUCKBYID, map,
				properties, null);
	}

	public Object companyUnlockOrderToTruckDriver(Certificate certificate,
			String orderID) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("orderID", orderID);

		return callWebService(BASE_URL, NAMESPACE,
				METHOD_COMPANY_UNLOCK_ORDER_TO_TRUCK_DRIVER, map, properties,
				null);
	}

	public Object common_getBalance(Certificate certificate)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		return callWebService(BASE_URL, NAMESPACE, COMMON_GETBALANCE, null,
				properties, null);
	}

	public Object common_AddCarInfo(Certificate certificate, String No,
			String Owner, String OwnerTel, String Driver, String DriverTel,
			String Type, String Demand, float CarLength, float Load,
			float Tonnage) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("No", No);
		map.put("Owner", Owner);
		map.put("OwnerTel", OwnerTel);
		map.put("Driver", Driver);
		map.put("DriverTel", DriverTel);
		map.put("Type", Type);
		map.put("Demand", Demand);
		map.put("CarLength", Float.valueOf(CarLength));
		map.put("Load", Float.valueOf(Load));
		map.put("Tonnage", Float.valueOf(Tonnage));

		return callWebService(BASE_URL, NAMESPACE, COMMON_ADDCARINFO, map,
				properties, null);
	}

	public Object common_getNews(Certificate certificate, int currentPage,
			int pageSize) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		return callWebService(BASE_URL, NAMESPACE, COMMON_GETNEWS, map,
				properties, null);
	}

	public Object common_getNewsView(Certificate certificate, String newsID)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("newsID", newsID);

		return callWebService(BASE_URL, NAMESPACE, COMMON_GETNEWSVIEW, map,
				properties, null);
	}

	public Object common_getMyPayLog(Certificate certificate, int currentPage,
			int pageSize) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("currentPage", currentPage);
		map.put("pageSize", pageSize);

		return callWebService(BASE_URL, NAMESPACE, COMMON_GETMYPAYLOG, map,
				properties, null);
	}

	public Object common_transferToSystemAccount(Certificate certificate,
			String money, boolean withdrawFromRealBankCard) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("money", BigDecimal.valueOf(Double.valueOf(money)));
		map.put("withdrawFromRealBankCard", withdrawFromRealBankCard);

		return callWebService(BASE_URL, NAMESPACE,
				COMMON_TRANSFERTOSYSTEMACCOUNT, map, properties, null);
	}

	public Object common_ModifyPassword(Certificate certificate, String newPwd,
			String oldPwd) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("newPwd", newPwd);
		map.put("oldPwd", oldPwd);

		return callWebService(BASE_URL, NAMESPACE, COMMON_MODIFYPASSWORD, map,
				properties, null);
	}

	public Object common_GetMyInfo(Certificate certificate) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		return callWebService(BASE_URL, NAMESPACE, COMMON_GETMYINFO, null,
				properties, null);
	}

	public Object common_SetMyInfo(Certificate certificate, String name,
			String nickName, String sex, String birthday,
			String identification, String province, String cities,
			String districts, String tel, String phone, String qq, String msn,
			String website, String email, String address, String remarks)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("name", name);
		map.put("nickName", nickName);
		map.put("sex", sex);
		try {
			if (birthday != null) {
				map.put("birthday", sDateFormat.parse(birthday));
			}
		} catch (Exception e) {
		}
		map.put("identification", identification);
		map.put("province", province);
		map.put("cities", cities);
		map.put("districts", districts);
		map.put("tel", tel);
		map.put("phone", phone);
		map.put("qq", qq);
		map.put("msn", msn);
		map.put("website", website);
		map.put("email", email);
		map.put("address", address);
		map.put("remarks", remarks);

		return callWebService(BASE_URL, NAMESPACE, COMMON_SETMYINFO, map,
				properties, null);
	}

	public Object common_transferToUserAccount(Certificate certificate,
			String money) throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("money", BigDecimal.valueOf(Double.valueOf(money)));

		return callWebService(BASE_URL, NAMESPACE,
				COMMON_TRANSFERTOUSERACCOUNT, map, properties, null);
	}

	public Object common_GetMyVerificationCode(String mobile)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("mobile", mobile);

		return callWebService(BASE_URL, NAMESPACE,
				COMMON_GETMYVERIFICATIONCODE, map, properties, null);
	}

	public Object common_ModifyPWD(String code, String mobile, String pwd)
			throws IOException, XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("code", code);
		map.put("mobile", mobile);
		map.put("pwd", pwd);

		return callWebService(BASE_URL, NAMESPACE, COMMON_MODIFYPWD, map,
				properties, null);
	}

	public Object MyLongitudeAndLatitude(Certificate certificate,
			float longitude, float latitude) throws IOException,
			XmlPullParserException {
		List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("certificate");
		pi.setValue(certificate);
		pi.setType(certificate.getClass());
		properties.add(pi);

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("longitude", longitude);
		map.put("latitude", latitude);

		return callWebService(BASE_URL, NAMESPACE, MYLONGITUDEANDLATITUDE, map,
				properties, null);
	}

}
